package com.bumptech.glide.load.resource.bitmap;

import android.graphics.Bitmap;
import android.media.MediaMetadataRetriever;
import android.os.ParcelFileDescriptor;
import com.bumptech.glide.load.DecodeFormat;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import java.io.IOException;

public class VideoBitmapDecoder
  implements BitmapDecoder<ParcelFileDescriptor>
{
  private static final MediaMetadataRetrieverFactory DEFAULT_FACTORY = new MediaMetadataRetrieverFactory();
  private static final int NO_FRAME = -1;
  private MediaMetadataRetrieverFactory factory;
  private int frame;

  public VideoBitmapDecoder()
  {
    this(DEFAULT_FACTORY, -1);
  }

  public VideoBitmapDecoder(int paramInt)
  {
    this(DEFAULT_FACTORY, checkValidFrame(paramInt));
  }

  VideoBitmapDecoder(MediaMetadataRetrieverFactory paramMediaMetadataRetrieverFactory)
  {
    this(paramMediaMetadataRetrieverFactory, -1);
  }

  VideoBitmapDecoder(MediaMetadataRetrieverFactory paramMediaMetadataRetrieverFactory, int paramInt)
  {
    this.factory = paramMediaMetadataRetrieverFactory;
    this.frame = paramInt;
  }

  private static int checkValidFrame(int paramInt)
  {
    if (paramInt < 0)
      throw new IllegalArgumentException("Requested frame must be non-negative");
    return paramInt;
  }

  public Bitmap decode(ParcelFileDescriptor paramParcelFileDescriptor, BitmapPool paramBitmapPool, int paramInt1, int paramInt2, DecodeFormat paramDecodeFormat)
    throws IOException
  {
    MediaMetadataRetriever localMediaMetadataRetriever = this.factory.build();
    localMediaMetadataRetriever.setDataSource(paramParcelFileDescriptor.getFileDescriptor());
    if (this.frame >= 0);
    for (Bitmap localBitmap = localMediaMetadataRetriever.getFrameAtTime(this.frame); ; localBitmap = localMediaMetadataRetriever.getFrameAtTime())
    {
      localMediaMetadataRetriever.release();
      paramParcelFileDescriptor.close();
      return localBitmap;
    }
  }

  public String getId()
  {
    return "VideoBitmapDecoder.com.bumptech.glide.load.resource.bitmap";
  }

  static class MediaMetadataRetrieverFactory
  {
    public MediaMetadataRetriever build()
    {
      return new MediaMetadataRetriever();
    }
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.bumptech.glide.load.resource.bitmap.VideoBitmapDecoder
 * JD-Core Version:    0.6.2
 */